package chapter6;

import java.util.Arrays;

public class Demo {
    public static void main(String[] args) {
        int[] arr1;
        int arr2[];
        int[] arr = new int[]{1,2,3,4,5,6,7};

        /*遍历*/
        for(int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }

        /*填充替换*/
        //Arrays.fill(arr , 1);
        //System.out.println(arr);

        /*排序*/
        Arrays.sort(arr);

        /*复制*/
        int[] arr3 = Arrays.copyOf(arr,10);
        for (int i = 0; i < arr3.length; i++) {
            System.out.print(arr3[i]);
        }
        System.out.println();
        int[] arr4 = Arrays.copyOfRange(arr, 1, 4);
        for (int i = 0; i < arr4.length; i++) {
            System.out.println(arr4[i]);
        }

        /*数组查询*/
        int index = Arrays.binarySearch(arr , 0, 4 , 4);
        System.out.println("index: " +index);
    }
}
